#pragma once
#include"public_struct.h"
class MyQueue {
public:
	/** Initialize your data structure here. */
	stack<int> s;
	stack<int> s2;
	MyQueue() {

	}

	void transform() {
		while (!s.empty()) {
			s2.push(s.top());
			s.pop();
		}
	}

	/** Push element x to the back of queue. */
	void push(int x) {
		s.push(x);
	}

	/** Removes the element from in front of queue and returns that element. */
	int pop() {
		int temp;
		if (!s2.empty()) {
			temp = s2.top();
			s2.pop();
		}
		else {
			transform();
			temp = s2.top();
			s2.pop();
		}
		return temp;
	}

	/** Get the front element. */
	int peek() {
		if (s2.empty()) {
			transform();
			
		}
		return s2.top();
	}

	/** Returns whether the queue is empty. */
	bool empty() {
		return s.empty() && s2.empty();
	}
};